using System.Collections;
using System.Collections.Generic;
using Unity.Netcode;
using UnityEngine;

public class bullet : NetworkBehaviour
{
    [SerializeField]private bool isInit = false;
    [SerializeField]private Vector3 direction = Vector3.zero;
    [SerializeField]private float speed = 5f;

    public void InitDriection(Vector3 dir)
    {
        direction = dir.normalized;
        isInit = true;
    }

    // Update is called once per frame
    void Update()
    {
        if (IsOwner && isInit)
        {
            UpdateBulletPos();
        }
    }
    
    private void UpdateBulletPos()
    {
        transform.position += direction * speed * Time.deltaTime;
    }
}
